﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Slja.Model;
using System.Text;

namespace FrameWork.web.Web.ServiceHandler
{
    /// <summary>
    /// GetShop 的摘要说明
    /// </summary>
    public class GetShop : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string strShopID = context.Request.Form["shopid"];
            int ShopID;
            if (!int.TryParse(strShopID,out ShopID))
            {
                 context.Response.Write( "null");
                 return;
            }
            Slja.BLL.ShopBLL shop = new Slja.BLL.ShopBLL();
            ShopModel mdl = shop.GetModel(ShopID);
            StringBuilder sb = new StringBuilder("({");
            sb.AppendFormat("{0}:\"{1}\",", "Address",mdl.Address);
            sb.AppendFormat("{0}:\"{1}\",", "City", mdl.City);
            sb.AppendFormat("{0}:\"{1}\",", "InnerCode", mdl.InnerCode);
            sb.AppendFormat("{0}:\"{1}\",", "SaleVolume", mdl.SaleVolume);
            sb.AppendFormat("{0}:\"{1}\",", "ShopID", mdl.ShopID);
            sb.AppendFormat("{0}:\"{1}\",", "ShopLev", mdl.ShopLev);
            sb.AppendFormat("{0}:\"{1}\",", "ShopLinkman", mdl.ShopLinkman);
            sb.AppendFormat("{0}:\"{1}\",", "ShopLinkmanTel", mdl.ShopLinkmanTel);
            sb.AppendFormat("{0}:\"{1}\",", "ShopName", mdl.ShopName);
            sb.AppendFormat("{0}:\"{1}\",", "ShopPromotor", mdl.ShopPromotor);
            sb.AppendFormat("{0}:\"{1}\",", "Square", mdl.Square);
            sb.AppendFormat("{0}:\"{1}\"", "TLCode", mdl.TLCode);//最后一个无逗号。
            sb.Append("})");
            context.Response.Write(sb.ToString());
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}